package com.jiang.专题.动态规划.Q53;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/02/16 17:51
 */
class Solution {
    public int maxSubArray(int[] nums) {
        int pre = 0, max = nums[0];
        for (int x: nums) {
            pre = Math.max(x, pre + x);
            max = Math.max(pre, max);
        }
        return max;
    }
}
